<?php
/**
 * @package PHPKit.
 * @author: mawenpei
 * @date: 2016/11/25
 * @time: 17:31
 */
require __DIR__ . '/../../../autoload.php';
require_once 'demoTask.php';
require_once 'demoWorker.php';
$config = require __DIR__ . '/config.php';

$daemon = new \HuoKit\JobMan\Daemon($config);

if (empty($argv[1]) || !in_array($argv[1], array('start', 'stop', 'restart', 'status')) ) {
    echo "Please input: bin/plumber start|stop|restart|status\n";
    exit();
}
switch($argv[1]){
    case 'start':
        $daemon->start();
        break;
    case 'stop':
        $daemon->stop();
        break;
    case 'restart':
        $daemon->restart();
        break;
    default:
        break;
}
